<template>
	<div class="">

		<div class="zzc" v-if="showzzc" @click="close"></div>

		<div class="container">
			<div class="title">项目需求</div>

			<div class="search_box" style="flex-wrap: wrap;">
				<input type="text" autocomplete="off" v-model="word2" class="form-control search_inp"
					placeholder="这里输入需求标题名称">


				<el-date-picker prefix-icon='none' style="margin-left: 10px;width: 150px" v-model="byDate"
					@change="changedate(1)" type="date" value-format="timestamp" placeholder="开始时间选择">
				</el-date-picker>
				<el-date-picker prefix-icon='none' style="margin-left: 10px;width: 150px;margin-right:10px;"
					v-model="byDate2" @change="changedate(2)" type="date" value-format="timestamp" placeholder="结束时间选择">
				</el-date-picker>

				<el-select v-model="value2" placeholder="所属项目" @change="page=1">
					<el-option key="" label="全部" value="">
					</el-option>
					<el-option v-for="item in options3" :key="item.id" :label="item.xmName" :value="item.id">
					</el-option>
				</el-select>

				<div class="sea_btn sear_btns"
					@click="page=1;naes=word2;value2s=value2;byDates=byDate;byDate2s=byDate2;getlist()">
					<img src="@assets/images/search.png" alt="">
					查询
				</div>
				<!-- v-if="$permissions.indexOf(13)  != -1" -->
				<div class="add_btn sear_btns" @click="showxq=true;type='add';">
					<img src="@assets/images/add.png" alt="">
					新增
				</div>
				<div class="del_btn sear_btns" @click="delopen(0)" v-if="$permissions.indexOf(168)  != -1">
					<img src="@assets/images/del.png" alt="">
					删除
				</div>
			</div>

			<div class="table-responsive mt-20">
				<h2 class="tcent" v-if="list.length ==0">暂时没有数据</h2>
				<table class="table table-hover" v-else>
					<tr>
						<th style="width: 50px;">
							<input type="checkbox" @change="changeall" v-model="choseall" name="all" id="arw"><label
								for="arw"></label>
						</th>
						<th>需求标题</th>
						<th class="tcent">需求描述</th>
						<th class="tcent">提出日期</th>
						<th class="tcent">优先级</th>
						<th class="tcent">所属项目</th>
						<th class="tcent" v-if="$permissions.indexOf(167)  != -1 || $permissions.indexOf(168)  != -1">
							操作</th>
					</tr>

					<tr v-for="item,index in list">
						<td style="width: 50px;">
							<input type="checkbox" v-model="item.chosesf" @change="chosechange" name="chose"
								:id="'rw'+item.id"><label :for="'rw'+item.id"></label>
						</td>
						<td>{{item.xqName}}</td>
						<td class="tcent">{{item.xqDescription}}</td>
						<td class="tcent">{{item.createDate}}</td>
						<td class="tcent">{{item.emergencyName}}</td>
						<td class="tcent">{{item.xmName}}</td>
						<td class="tcent" v-if="$permissions.indexOf(167)  != -1 || $permissions.indexOf(168)  != -1">
							<a href="javascript:;" class=" btn-green btns" @click="editxq(index)"
								v-if="$permissions.indexOf(167)  != -1">编辑</a>
							<a href="javascript:;" class="btn-gray btns" @click="delopen(item.id)"
								v-if="$permissions.indexOf(168)  != -1">删除</a>
							<a href="javascript:;" class="btn-org btns" @click="openadd(item)"
								v-if="$permissions.indexOf(167)  != -1">转为任务</a>
						</td>
					</tr>
				</table>

				<div class="page_box">
					<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
						:current-page="page" :page-sizes="[10, 30, 60, 100]" :page-size="limit"
						layout="total, sizes, prev, pager, next, jumper" :total="inglen">
					</el-pagination>
				</div>
			</div>
		</div>

		<!--新增需求-->
		<div :class="showxq?'modal in fade':'modal fade'" tabindex="-1" role="dialog" id="keshi"
			:style="showxq?'display: block;z-index:200;':'z-index:200;'">
			<div class="cent w600"
				style="justify-content: center;width: 860px !important;height: calc(100vh - 350px);margin: calc(50vh - 337px) auto;">
				<div class="modal-dialog" role="document" style="width: 100%;height: 630px;">
					<div class="modal-content">
						<div class="modal-header tit">
							<em></em> {{type == 'add'?'新增需求':'修改需求'}}
							<div class="right" @click="closexm">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"
									style="line-height: normal;"><span class="iconfont icon-cha"
										aria-hidden="true"></span> </button>
							</div>
						</div>
						<!--表单-->
						<div class="modal-body h100 search-cont" style="padding: 15px 27px;height: 498px;">
							<div class="sublist">
								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>需求名称</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="xqinfo.xqName"
												placeholder="输入需求名称">
										</div>
									</div>
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>需求类型</label>
										<div class="input-cont">
											<el-select v-model="xqinfo.type" placeholder="需求类型">
												<el-option v-for="item in options_xq" :key="item.id" :label="item.name"
													:value="item.id">
												</el-option>
											</el-select>
										</div>
									</div>
								</div>

								<div class="subli">
									<div class="sublia">
										<label class="subl">需求描述</label>
										<div class="input-cont">
											<textarea name="" v-model="xqinfo.xqDescription" id="" maxlength="1000"
												style="height: 200px;" placeholder="请输入需求描述"></textarea>
											<!-- <div class="snum">{{xqinfo.xqDescription.length}}/1000</div> -->
										</div>
									</div>
								</div>

								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>提出人</label>
										<div class="input-cont">
											<el-autocomplete popper-class="my-autocomplete" :trigger-on-focus="false"
												v-model="uname_xq" value-key="realName"
												:fetch-suggestions="querySearch_xq" placeholder="请选择提出人"
												@select="handleSelect_xq">
												<template slot-scope="{ item }">
													<div class="tab_tr">
														<div class="tab_td">{{ item.userName }}</div>
														<div class="tab_td">{{ item.realName }}</div>
														<div class="tab_td">{{ item.departName }}</div>
														<div class="tab_td">{{ item.phoneNo }}</div>
													</div>

												</template>
											</el-autocomplete>
											<span class="iconfont icon-list" @click="openuseralert()"></span>
										</div>
									</div>
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>所属项目</label>
										<div class="input-cont">
											<el-select v-model="xqinfo.xmId" placeholder=" 所属项目" name="name"
												value-key="id">
												<el-option v-for="item in options3" :key="item.id" :label="item.xmName"
													:value="item.id">
												</el-option>
											</el-select>
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left" style="width:100%">
										<label class="subl"><em class="red">*</em>优先级：</label>
										<div class="radio">
											<div>
												<input type="radio" v-model="xqinfo.emergencyId" name="emergencyId"
													value="1" checked id="n">
												<label for="n"></label>
												<span @click="xqinfo.emergencyId=1">常规处理</span>
											</div>
											<div>
												<input type="radio" v-model="xqinfo.emergencyId" name="emergencyId"
													value="2" checked id="m">
												<label for="m"></label>
												<span @click="xqinfo.emergencyId=2">较紧急</span>
											</div>
											<div>
												<input type="radio" v-model="xqinfo.emergencyId" name="emergencyId"
													value="3" checked id="l">
												<label for="l"></label>
												<span @click="xqinfo.emergencyId=3">非常紧急</span>
											</div>
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left" style="width:100%">
										<label class="subl">附件信息：</label>
										<div class="task_r">
											<el-upload class="upload-demo" ref="upload" :data="{project:'xm'}"
												:headers="{'Authorization':token}" :action="$url+'/file/upload'"
												:show-file-list="false" :file-list="fileList3"
												:before-upload="beforeUpload2" :on-success="uploadsuc3" :multiple="true"
												:auto-upload="true">
												<div class="upload_btn">
													<img src="@/assets/images/upload.png" alt="">点击上传
												</div>
											</el-upload>
											<div class="upload_list">
												<div class="up_li" v-for="item,index in files3">
													<div class="file_name">
														<div class="file_name_left"><img
																src="@/assets/images/upload.png" alt="">{{item}}
														</div>
														<div class="file_name_right">
															<div class="file_check" @click="check_file($url + item)">查看
															</div>
															<div class="file_del" @click="del_file3(index)">
																删除
															</div>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div class="modal-footer tcent">
							<button class="btn btn-primary" @click="addxq">确定</button>
							<button class="btn btn-info close_eng" @click="closexm">关闭</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--报修人-->
		<div :class="user_alert?'modal in fade':'modal fade'" role="dialog"
			:style="user_alert?' align-items: center;justify-content: center;display: flex;z-index:202;':'z-index:202'"
			id="engineer">

			<div class="cent w700" style="height: 865px;max-width: 955px;max-height:calc(100vh - 50px)">

				<div class="modal-dialog" role="document">
					<div class="modal-content" style="overflow: visible;">
						<div class="modal-header tit">
							<em></em>选择用户
							<div class="right" @click="closeusertalert">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
										class="iconfont icon-cha" aria-hidden="true"></span> </button>
							</div>
						</div>
						<!--表单-->
						<div class="modal-body h100"
							style="overflow-x: hidden;overflow-y:scroll;height:760px;max-height:calc(100vh - 150px)">

							<div class="left">
								<div class="zTreeDemoBackground">
									<ul id="treeDemo_p4" class="ztree" @select="choseroom_user"></ul>
								</div>
							</div>
							<div class="right" style="overflow: visible;">
								<div class="search">
									<!-- <form> -->
									<div class="form-group" style="display: flex;padding-right: 0;">
										<input class="form-control" autocomplete="off"
											@keydown.enter="page2=1;word_users=word_user;getalluserlist()"
											v-model="word_user" placeholder="输入关键字">
										<div style="margin-left: 10px;" class="btn btn-success"
											@click="page2=1;word_users=word_user;getalluserlist()">
											<span class="iconfont icon-chaxun"
												style="line-height: 34px;vertical-align: baseline;"></span>
										</div>
									</div>
									<!-- </form> -->
								</div>

								<div class="enr_alert_scorll">
									<div style="height: 552px;overflow-y: auto;">
										<h2 class="tcent" v-if="user_all.length ==0">暂时没有数据</h2>
										<table class="table table-hover smallTab" v-else>
											<tr>
												<th></th>
												<th>账号</th>
												<th>姓名</th>
												<th>电话</th>
											</tr>
											<tr v-for="item,index in user_all">
												<td>
													<input type="radio" v-model="principalId" :value="item.id"
														@change="changechose(item.id,item.realName,item.phoneNo)"
														name="chose2" :id="'c'+item.id"><label
														:for="'c'+item.id"></label>
												</td>
												<td>{{item.userName}}</td>
												<td>{{item.realName}}</td>
												<td>{{item.phoneNo}}</td>
											</tr>
										</table>
									</div>
									<div class="Spage" style="margin: 20px 0;">
										<el-pagination @current-change="handleCurrentChange2" :current-page="page2"
											style="display: flex;justify-content: center;" :pager-count="5"
											:page-size="10" :page-count="num2" layout="prev, pager, next">
										</el-pagination>
									</div>


									<div class="tcent" style="margin-bottom: 30px;">
										<button class="btn btn-primary" @click="sure_user">确定</button>&emsp;
										<button class="btn btn-default" @click="closeusertalert">关闭</button>
									</div>
								</div>


							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="alzzc" v-if="delalert">
			<div class="del_alert">
				<div class="modal-header tit" style="text-align: left;">
					<em></em>信息
					<div class="right" @click="delalert=false">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"
							style="line-height: normal;"><span class="iconfont icon-cha" aria-hidden="true"></span>
						</button>
					</div>
				</div>
				<div class="alert_info">确认要删除选中的<span>{{delnum}}</span>条数据吗？</div>
				<div class="alert_btns">
					<div class="alert_sure" @click="del">确认</div>
					<div class="alert_close" @click="delalert=false">取消</div>
				</div>
			</div>
		</div>

		<!--转任务-->
		<div :class="showadd?'modal in fade':'modal fade'" tabindex="-1" role="dialog" id="keshi"
			:style="showadd?'display: block;z-index:200;':'z-index:200;'">
			<div class="cent w600"
				style="justify-content: center;width: 860px !important;height: calc(100vh - 250px);margin: calc(50vh - 364px) auto;">
				<div class="modal-dialog" role="document" style="width: 100%;height: 680px;">
					<div class="modal-content">
						<div class="modal-header tit">
							<em></em>{{info.id?'编辑任务':'新建任务'}}
							<div class="right" @click="showadd=false;">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"
									style="line-height: normal;"><span class="iconfont icon-cha"
										aria-hidden="true"></span> </button>
							</div>
						</div>
						<!--表单-->
						<div class="modal-body h100 search-cont" style="padding: 15px 27px;height: 558px;">
							<div class="sublist">
								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>项目名称</label>
										<el-select v-model="info.xmId" placeholder="项目名称" @change="changenew">
											<el-option v-for="item in options3" :key="item.id" :label="item.xmName"
												:value="item.id">
											</el-option>
										</el-select>
									</div>
									<div class="subli_left">
										<label class="subl">阶段</label>
										<el-select v-model="info.stageName" placeholder="阶段" @change="$forceUpdate()">
											<el-option v-for="item in options7" :key="item.xmStageName"
												v-if="item.id != 0" :label="item.xmStageName" :value="item.xmStageName">
											</el-option>
										</el-select>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>任务名称</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="info.rwName"
												placeholder="输入任务名称">
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>开始时间</label>
										<div class="input-cont">
											<el-date-picker v-model="info.beginDate" type="datetime"
												@change="changedate(1)" value-format="timestamp" placeholder="开始时间">
											</el-date-picker>
										</div>
									</div>
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>结束时间</label>
										<div class="input-cont">
											<el-date-picker v-model="info.finishDate" type="datetime"
												@change="changedate(2)" value-format="timestamp" placeholder="结束时间">
											</el-date-picker>
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>安排人</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="createName" readonly
												placeholder="输入任务名称">
											<!-- <el-autocomplete popper-class="my-autocomplete" :trigger-on-focus="false"
												v-model="createName" value-key="realName"
												:fetch-suggestions="querySearch_u" placeholder="请选择安排人"
												@select="handleSelect_u">
												<template slot-scope="{ item }">
													<div class="tab_tr">
														<div class="tab_td">{{ item.userName }}</div>
														<div class="tab_td">{{ item.realName }}</div>
														<div class="tab_td">{{ item.departName }}</div>
														<div class="tab_td">{{ item.phoneNo }}</div>
													</div>
		
												</template>
											</el-autocomplete>
											<span class="iconfont icon-list"
												@click="utype='addap';openuseralert()"></span> -->
										</div>
									</div>
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>审批人</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="cnames" readonly
												placeholder="请选择审批人">
											<span class="iconfont icon-list"
												@click="utype='addsp';openuseralert2()"></span>
										</div>
									</div>
								</div>

								<div class="subli">
									<div class="subli_left">
										<label class="subl"><em class="red">*</em>执行人</label>
										<div class="input-cont">
											<el-autocomplete popper-class="my-autocomplete" :trigger-on-focus="false"
												v-model="completeName" value-key="realName"
												:fetch-suggestions="querySearch_u" placeholder="请选择执行人"
												@select="handleSelect_u2">
												<template slot-scope="{ item }">
													<div class="tab_tr">
														<div class="tab_td">{{ item.userName }}</div>
														<div class="tab_td">{{ item.realName }}</div>
														<div class="tab_td">{{ item.departName }}</div>
														<div class="tab_td">{{ item.phoneNo }}</div>
													</div>

												</template>
											</el-autocomplete>
											<span class="iconfont icon-list"
												@click="utype='addzx';openuseralert()"></span>
										</div>
									</div>
									<div class="subli_left">
										<label class="subl">抄送人</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="cnames2" readonly
												placeholder="请选择抄送人">
											<span class="iconfont icon-list"
												@click="utype='addcs';openuseralert2()"></span>
										</div>
									</div>
								</div>

								<div class="subli">
									<div class="sublia">
										<label class="subl">任务描述</label>
										<div class="input-cont">
											<textarea name="" v-model="info.rwDescripton" id=""
												placeholder="请输入任务描述"></textarea>
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli">
										<div class="subli_left" style="width:100%">
											<label class="subl"><em class="red">*</em>优先级：</label>
											<div class="radio" style="margin-bottom: 0;">
												<el-radio-group v-model="info.emergencyId">
													<el-radio :label="1">常规处理</el-radio>
													<el-radio :label="2">较紧急</el-radio>
													<el-radio :label="3">非常紧急</el-radio>
												</el-radio-group>
											</div>
										</div>
									</div>
								</div>
								<div class="subli">
									<div class="subli_left">
										<label class="subl">评分</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="info.score"
												placeholder="输入评分">
										</div>
									</div>
									<div class="subli_left">
										<label class="subl">工作时长</label>
										<div class="input-cont">
											<input type="text" class="form-control" v-model="info.workTime"
												placeholder="输入工作时长（单位小时）">
										</div>
									</div>
								</div>

								<div class="subli" style="align-items: flex-start;">
									<label class="subl">附件上传</label>
									<div class="check_li_r">
										<el-upload class="upload-demo" ref="upload" :data="{project:'rw'}"
											:headers="{'Authorization':token}" :action="$url+'/file/upload'"
											:show-file-list="false" :file-list="fileList3"
											:before-upload="beforeUpload" :on-success="uploadsuc3" :multiple="true"
											:auto-upload="true">
											<div class="upload_btn">
												<img src="@/assets/images/upload.png" alt="">点击上传
											</div>
										</el-upload>
										<div class="upload_list">
											<div class="up_li" v-for="item,index in files3">
												<div class="file_name">
													<div class="file_name_left"><img src="@/assets/images/upload.png"
															alt="">{{item.name}}
													</div>
													<div class="file_name_right">
														<div class="file_check"
															@click="check_file($url + item.relativePath)">查看
														</div>
														<div class="file_del" @click="del_file3(index)">
															删除
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>


							</div>
						</div>
						<div class="modal-footer tcent">
							<button class="btn btn-primary" @click="showData">确定</button>
							<button class="btn btn-info close_eng" @click="showadd=false">关闭</button>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!--选择添加工程师-->
		<div :class="alert_show?'modal in fade':'modal fade'" role="dialog"
			:style="alert_show?' align-items: center;justify-content: center;display: flex;z-index:200':''"
			id="engineer">

			<div class="cent w700" style="height: 865px;max-width: 955px;max-height:calc(100vh - 50px)">

				<div class="modal-dialog" role="document">
					<div class="modal-content" style="overflow: visible;">

						<div class="modal-header tit">
							<em></em>选择用户
							<div class="right" @click="closealert">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
										class="iconfont icon-cha" aria-hidden="true"></span> </button>
							</div>
						</div>
						<!--表单-->
						<div class="modal-body h100" style="height:760px;max-height:calc(100vh - 150px)">
							<div class="left">
								<div class="zTreeDemoBackground">
									<ul id="treeDemo2" class="ztree" @select="choseroom_user"></ul>
								</div>
							</div>
							<div class="right" style="overflow: visible;">
								<div class="search">
									<!-- <form> -->
									<div class="form-group" style="display: flex;padding-right: 0;">
										<input class="form-control" autocomplete="off"
											@keydown.enter="page2=1;word_users=word_user;getalluserlist()"
											v-model="word_user" placeholder="输入关键字">
										<div style="margin-left: 10px;" class="btn btn-success"
											@click="page2=1;word_users=word_user;getalluserlist()">
											<span class="iconfont icon-chaxun"
												style="line-height: 34px;vertical-align: baseline;"></span>
										</div>
									</div>
									<!-- </form> -->
								</div>
								<div class="txt-black">为您找到{{inglen2}}位 <span class="txt-blue">用户</span> </div>

								<div class="enr_alert_scorll">
									<div style="height: 552px;overflow-y: auto;">
										<h2 class="tcent" v-if="cuserlist.length ==0">暂时没有数据</h2>
										<table class="table table-hover smallTab" v-else>
											<tr>
												<th><input type="checkbox" @change="changeall2" v-model="choseall2"
														name="allt" id="tuser"><label for="tuser"></label></th>
												<th>账号</th>
												<th>姓名</th>
												<th>电话</th>
											</tr>
											<tr v-for="item,index in cuserlist">
												<td>
													<input type="checkbox" v-model="item.chosesf" @change="chosechange2"
														name="chose2" :id="'tuser'+item.id"><label
														:for="'tuser'+item.id"></label>
												</td>
												<td>{{item.userName }}</td>
												<td>{{item.realName}}</td>
												<td>{{item.phoneNo}}</td>
											</tr>
										</table>
									</div>
									<div class="Spage" style="margin: 20px 0;">
										<el-pagination @current-change="handleCurrentChange2" :current-page="page2"
											style="display: flex;justify-content: center;" :pager-count="5"
											:page-size="10" layout="prev, pager, next" :total="inglen2">
										</el-pagination>
									</div>

									<div class="tcent" style="margin-bottom: 30px;">
										<button class="btn btn-primary" @click="cusers">确定</button>&emsp;
										<button class="btn btn-default" @click="closealert()">关闭</button>
									</div>
								</div>


							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="loading-content" v-if="showloading">
			<div class="loading-spinner">
				<svg viewBox="25 25 50 50" class="circular">
					<circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
				</svg>
			</div>
			<div class="loading-text">加载中...</div>
		</div>
	</div>
</template>

<script type="text/babel">

	export default {
		name: "",
		data() {
			return {
				utype:"",
				type:"",
				value2:"",
				value2s:"",
				naes:"",
				word2:"",
				byDate:"",
				byDates:"",
				byDate2:"",
				byDate2s:"",
				principalId:"",
				word_user:"",
				num2:"",
				page: 1,
				options3: [],
				list: [],
				options_xq: [],
				user_all: [],
				files3: [],
				fileList3: [],
				files3id: [],
				options7: [],
				cnames2: [],
				cnames: [],
				inglen: 0,
				limit: 10,
				completeName:"",
				uname_xq:"",
				xqinfo:{emergencyId:1},
				info:{emergencyId:1},
				showzzc: false,
				showxq: false,
				showloading: false,
				showadd: false,
				delalert: false,
				alert_show: false,
				choseall: false,
				token:sessionStorage.getItem('token'),
				cname_sp:[],
				limit2: 10,
				inglen2: 0,
				page2: 1,
				user_alert:false,
				setting_u: {
					
					treeId: 'id',
					data: {
						key: {
							name: 'name'
						}
					},
					callback: {
						onClick: this.choseroom_user
					}
				},
				did:"",
				word_users:"",
				options5:[],
				user_c2:[],
				user_c:[],
				cuserlist:[],
				mbid:"",
				createName:sessionStorage.getItem('realName'),
			}
		},
		components: {},

		mounted() {
			this.getlist();
			this.getxqtype();
			this.getproject();
			this.getmb();
		},

		methods: {
			changeall2(){
				console.log(this.utype)
				if(this.choseall2){
					for (var i = 0; i < this.cuserlist.length; i++) {
						this.cuserlist[i].chosesf = true
						if(this.utype == 'addsp'){
							this.user_c.push(this.cuserlist[i].id)
							this.cname.push(this.cuserlist[i].realName)
							console.log(this.cname)
							this.user_c = this.user_c.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
							this.cname = this.cname.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
						}else if(this.utype == 'addcs'){
							this.user_c2.push(this.cuserlist[i].id)
							this.cname2.push(this.cuserlist[i].realName)
							this.user_c2 = this.user_c2.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
							this.cname2 = this.cname2.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
						}
					}
				}else{
					
						for (var i = 0; i < this.cuserlist.length; i++) {
							this.cuserlist[i].chosesf = false
							if(this.utype == 'addsp'){
								this.user_c.splice(this.user_c.indexOf(this.cuserlist[i].id),1)
								this.cname.splice(this.cname.indexOf(this.cuserlist[i].realName),1)
							}else if(this.utype == 'addcs'){
									this.user_c2.splice(this.user_c2.indexOf(this.cuserlist[i].id),1)
									this.cname2.splice(this.cname2.indexOf(this.cuserlist[i].realName),1)
							}
						}
					}
					if(this.check == 1){
						this.showData('check')
					}
					this.$forceUpdate()
			},
			
			chosechange2(){
				var a = 0
				for (var i = 0; i < this.cuserlist.length; i++) {
					if(this.cuserlist[i].chosesf == true){
						a++
						if(this.utype == 'addsp'){
							this.user_c.push(this.cuserlist[i].id)
							this.cname.push(this.cuserlist[i].realName)
							this.user_c = this.user_c.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
							this.cname = this.cname.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
						}else if(this.utype == 'addcs'){
							this.user_c2.push(this.cuserlist[i].id)
							this.cname2.push(this.cuserlist[i].realName)
							this.user_c2 = this.user_c2.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
							this.cname2 = this.cname2.filter((item, index, array) => {
							  return array.indexOf(item) === index
							})
						}
						
					}else{
						if(this.utype == 'addsp'){
							if(this.cname.indexOf(this.cuserlist[i].realName) > -1){
								this.cname.splice(this.cname.indexOf(this.cuserlist[i].realName),1)
							}
							if(this.user_c.indexOf(this.cuserlist[i].id) > -1){
								this.user_c.splice(this.user_c.indexOf(this.cuserlist[i].id),1)
							}
						}else if(this.utype == 'addcs'){
							if(this.cname2.indexOf(this.cuserlist[i].realName) > -1){
								this.cname2.splice(this.cname2.indexOf(this.cuserlist[i].realName),1)
							}
							if(this.user_c2.indexOf(this.cuserlist[i].id) > -1){
								this.user_c2.splice(this.user_c2.indexOf(this.cuserlist[i].id),1)
							}
						}
					}
					
				}
				console.log(this.user_c)
				console.log(this.user_c2)
				if(a == this.cuserlist.length){
					this.choseall2=true
				}else{
					this.choseall2=false
				}
				this.$forceUpdate()
				// if(this.check == 1){
				// 	this.showData('check')
				// }
			},
			cusers(){
				
				if(this.utype == 'addsp'){
					this.cnames = this.cname.join(',')
				}else if(this.utype == 'addcs'){
					this.cnames2 = this.cname2.join(',')
				}
				this.alert_show=false
				this.word_user = ''
				this.word_users = ''
				this.deptId = ''
				this.getrooms()
				this.did = ''
				this.ztree_obj_u.cancelSelectedNode();
				this.getalluserlist()
			},
			closealert(){
				
				this.choseall2=false
				this.alert_show=false;
				// this.user_c = []
				// this.cname = []
				// this.cname2 = []
				if(this.utype == 'addsp'){
					this.cnames = this.cname.join(',')
				}else if(this.utype == 'addcs'){
					this.cnames2 = this.cname2.join(',')
				}
				this.word_user = ''
				this.word_users = ''
				this.deptId = ''
				this.did = ''
				this.getrooms()
				this.ztree_obj_u.cancelSelectedNode();
				this.getalluserlist()
			},
			
			openuseralert2(){
				console.log(this.user_c)
				console.log(this.user_c2)
				this.getrooms()
				this.page2 = 1
				this.getalluserlist()
				this.alert_show = true
				this.$forceUpdate()
			},
			querySearch_u(queryString, cb) {
				var that = this
				var name = this.completeName?this.completeName:''
				var id = this.info.departId?this.info.departId:''
				var url = encodeURI(this.$url + '/sys/user/select?realName='+name)
				this.$http.get(url)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.restaurants_u = response.data.data
						that.restaurants_u.unshift({userName:"账号",realName:"姓名",departName:"科室",phoneNo:"电话"})
						var restaurants_u = that.restaurants_u;
						var results = queryString ? restaurants_u.filter(that.createFilter_u(queryString)) : restaurants_u;
						// 调用 callback 返回建议列表的数据
						if(results.length == 0){
							results.unshift({userName:"暂无内容",realName:"",departName:"",phoneNo:""})
						}else{
							if(results[0].id){
								results.unshift({userName:"账号",realName:"姓名",departName:"科室",phoneNo:"电话"})
							}
						}
						
						cb(results);
						// console.log(that.restaurants)
					})
					.catch(function(error) {
						console.log(error);						
						that.$Toast('网络拥堵，刷新一下');
					});
					
			  
			},
			createFilter_u(queryString) {
				return (restaurant) => {
					// if(restaurant.realName){
						return (restaurant.realName.toLowerCase().indexOf(queryString.toLowerCase()) != -1);
					// }
				};
			},
			handleSelect_u2(item,type) {
				if(!item.id){
					this.info.completeId=''
					return 
				}
				this.info.completeName = item.realName
				this.info.completeId = item.id				
				if(type){
					this.showData('check')
				}
			},
			changexm(e){
				this.showloading = true
				var param ={
						id:e
					}
				var that = this
				this.$http.post(this.$url + '/xm/stage/select', this.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.options7 = response.data.data
						that.showloading = false
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			},
			changenew(e){
				this.info.stageName ='';
				this.changexm(e)
			},
			// changerw(id){
				
			// },
			// 模板
			getmb() {
				var that = this
				this.$http.get(this.$url + '/rw/template/select')
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.options5 = response.data.data
						for (var i = 0; i < that.options5.length; i++) {
							if(that.options5[i].isDefault == 1){
								that.value5 = that.options5[i].id
								that.mbid = that.options5[i].id
								console.log(that.mbid)
							}
						}
						
					})
					.catch(function(error) {
					});
			},
			openadd(item){
				this.showloading = true
				
				// var mid = id>0?id:this.mbid
				
				this.user_c = []
				this.cname = []
				this.cname2 = []
				var that = this
				var url = ''
				if(!this.mbid){
					that.info={emergencyId:1,rwName :item.xqName,xmId :item.xmId,rwDescripton :item.xqDescription}
					that.info.createId = sessionStorage.getItem('uid')
					that.createName = sessionStorage.getItem('realName')
					that.completeName = ''
					that.cnames = ''
					that.cnames2 = ''
					that.showloading = false
					that.showadd=true
					return
				}
				console.log(this.mbid)
				this.$http.get(this.$url + '/rw/template/selectOne?id='+this.mbid)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.info = {
							rwName :item.xqName,
							stageName :response.data.data.stageName,
							rwDescripton :item.xqDescription,
							xmId :item.xmId,
							createId :response.data.data.createId?response.data.data.createId:'',
							completeId :response.data.data.completeId?response.data.data.completeId:'',
							agreeIds :response.data.data.agreeIds?response.data.data.agreeIds.split(','):[],
							notifyIds :response.data.data.notifyIds?response.data.data.notifyIds.split(','):[],
							beginDate :response.data.data.beginDate?new Date(response.data.data.beginDate):'',
							finishDate :response.data.data.finishDate?new Date(response.data.data.finishDate):'',
							score :response.data.data.score?response.data.data.score:'',
							workTime :response.data.data.workTime?response.data.data.workTime:'',
							fileIds :response.data.data.fileIds?response.data.data.fileIds.split(','):[],
							emergencyId: response.data.data.emergencyId?response.data.data.emergencyId:1
						}
						that.changexm(that.info.xmId)
						that.user_c = response.data.data.agreeIds?response.data.data.agreeIds.split(','):[]
						for (var i = 0; i < that.user_c.length; i++) {
							that.user_c[i] = parseInt(that.user_c[i])
						}
						that.cnames = []
						// that.cname = []
						if(response.data.data.agreeUsers){
							for (var i = 0; i < response.data.data.agreeUsers.length; i++) {
								that.cnames.push(response.data.data.agreeUsers[i].realName)
								// that.cname.push(response.data.data.agreeUsers[i].realName)
							}
						}
						that.user_c2 = response.data.data.notifyIds?response.data.data.notifyIds.split(','):[]
						console.log()
						for (var i = 0; i < that.user_c2.length; i++) {
							that.user_c2[i] = parseInt(that.user_c2[i])
						}
						that.cnames2 = []
						// that.cname2 = []
						if(response.data.data.notifyUsers){
							for (var i = 0; i < response.data.data.notifyUsers.length; i++) {
								that.cnames2.push(response.data.data.notifyUsers[i].realName)
								// that.cname2.push(response.data.data.notifyUsers[i].realName)
							}
						}
						that.info.createId = sessionStorage.getItem('uid')
						that.completeName = response.data.data.compleTeName?response.data.data.compleTeName:''
						// that.createName = response.data.data.createName?response.data.data.createName:''
						that.createName = sessionStorage.getItem('realName')
						that.showloading = false
						that.showadd=true
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
				
			},
			// 表单提交
			showData(type) {				
				this.info.rwName = this.info.rwName?this.info.rwName:''
				this.info.stageName = this.info.stageName?this.info.stageName:''
				this.info.createId = this.info.createId?this.info.createId:''
				this.info.completeId = this.info.completeId?this.info.completeId:''
				this.info.agreeIds = this.user_c.length>0?this.user_c.join(','):''
				this.info.rwDescripton = this.info.rwDescripton?this.info.rwDescripton:''
				this.info.beginDate = this.info.beginDate?this.info.beginDate:''
				this.info.finishDate = this.info.finishDate?this.info.finishDate:''
				if(type=='check2'){
					this.info.stageName=''
					this.changexm(this.info.xmId)
				}else if(type=='check'){
					// if (this.info.stageName.trim() == '') {
					// 	this.$Toast("请填写必填选项");
					// 	return
					// }
				}
				console.log(this.info)
				if (this.info.rwName.trim() == '' || this.info.createId == '' || this.info.completeId == '' ||this.info.agreeIds == ''|| this.info.beginDate == ''|| this.info.finishDate == '') {
					this.$Toast("请填写必填选项");
					return
				}
				if(this.info.createDate){
					delete this.info.createDate
					delete this.info.agreeUsers
					delete this.info.notifyUsers
					delete this.info.completeName
				}
				this.info.beginDate = this.info.beginDate?this.timeFormate(this.info.beginDate):''
				this.info.finishDate = this.info.finishDate?this.timeFormate(this.info.finishDate):''
				this.info.notifyIds = this.user_c2.length>0?this.user_c2.join(','):''
				this.info.fileIds = this.files3id.length>0?this.files3id.join(','):''
				console.log(this.info)
				
				this.showloading = true
				var that = this
				this.$http.post(this.$url + '/rw/save', this.$qs.stringify(this.info))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.$Toast(response.data.msg);
						that.showadd = false
						that.showloading = false
						that.check = 0
						that.user_c = []
						that.user_c2 = []
						that.cname = []
						that.cname2 = []
						that.cnames = ""
						that.cname2s = ""
						// if(type=='check'){
						// 	that.getinfo()
						// 	that.pager = 1
						// 	that.rightlist = []
						// 	that.getrightlist()
						// }
						console.log(type)
						 
						that.getlist()
						that.$forceUpdate()
					})
					.catch(function(error) {
						that.$Toast('网络拥堵，刷新一下');
					});
				
			},
			
			delopen(id){
				var ids=''
				var num = 0
					for (var i = 0; i < this.list.length; i++) {
						if(this.list[i].chosesf==true){
							ids = ids+''+this.list[i].id+','
							num++
						}
					}
					this.ids = ids.substring(0,ids.length-1)
					if(this.ids==''){
						this.$Toast('暂无选中');
						return
					}
				this.delnum = num
				this.delalert=true		
			},
			changeall(){
				if(this.choseall){
					for (var i = 0; i < this.list.length; i++) {
						this.list[i].chosesf = true
					}
				}else{
					for (var i = 0; i < this.list.length; i++) {
						this.list[i].chosesf = false
					}
				}
			},
			chosechange(){
				for (var i = 0; i < this.list.length; i++) {
					if(this.list[i].chosesf == true){
						this.choseall=true
					}else{
						this.choseall=false
						break
					}
					
				}
			},
			// 删除需求
			del(){
				var that = this
				var param = {
					ids:that.ids
				}
				that.$http.post(that.$url + '/xm/xq/delete', that.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.$Toast(response.data.msg);
						that.page=1
						that.delalert=false
									that.getlist()
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
			},
			
			editxq(index){
				this.type = 'edit'
				var param = {
					id:this.list[index].id
				}
				this.showloading = true
				var that = this
				this.$http.post(this.$url + '/xm/xq/selectOne', this.$qs.stringify(param))
					.then(function(response) {
						that.xqinfo = {
							id:response.data.data.id,
							xqName:response.data.data.xqName,
							xqDescription:response.data.data.xqDescription,
							type:response.data.data.type,
							adviceman:response.data.data.adviceman,
							emergencyId:response.data.data.emergencyId,
							xmId:response.data.data.xmId,
							enclosure :response.data.data.enclosure?response.data.data.enclosure.split(','):[],
						}
						
						that.uname_xq = response.data.data.advicemanName
						that.files3 = []
						that.files3id = []
						if(response.data.data.listFile){
							for (var i = 0; i < response.data.data.listFile.length; i++) {
								that.files3.push(response.data.data.listFile[i].relativePath)
								that.files3id.push(response.data.data.listFile[i].id)
							}
						}
						that.showxq = true
						that.showloading = false
					})
					.catch(function(error) {
						console.log(error);
						that.$Toast('网络拥堵，刷新一下');
					});
				
				
			},
			changechose(id,name,phone){
				if(this.utype == 'addzx'){
					this.completeName = name
					this.info.completeId = id
					
				}else{
					this.uname_xq = name
					this.xqinfo.adviceman = id
				}
					
			},
			getxqtype() {
				this.showloading = true
			
				var that = this
				this.$http.post(this.$url + '/xm/xq/type/select')
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.options_xq = response.data.data
						that.showloading = false
					})
					.catch(function(error) {
						console.log(error);
						// sessionStorage.setItem('token','undefined')
						// that.$router.push('/login')
						
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
			addxq() {
				
				if(!this.xqinfo.xqName || !this.xqinfo.type || !this.xqinfo.adviceman || !this.xqinfo.emergencyId ||!this.xqinfo.xmId){
					this.$Toast('请填写必填项');
					return
				}
				// this.xqinfo.xmId = this.info.id
				this.xqinfo.enclosure = this.files3id.length>0?this.files3id.join(','):''
				console.log(this.xqinfo)
				this.showloading = true
				var that = this
				this.$http.post(this.$url + '/xm/xq/save', this.$qs.stringify(this.xqinfo))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.$Toast(response.data.msg);
						that.showxq = false
						that.showloading = false
						that.xqinfo =  {emergencyId:1}
						that.uname_xq = ''
						that.files3id = []
						that.files3 = []
						that.fileList3 = []
						that.pagex=1
						that.getlist()
					})
					.catch(function(error) {
						that.$Toast('网络拥堵，刷新一下');
					});
				
			},
			closexm(){
				this.showxq = false;
			
				this.xqinfo =  {emergencyId:1}
				this.uname_xq = ''
				
				this.uname =''
				this.uname2 =''
				this.user_c = []
				this.user_c2 = []
				this.user_sp = []
				
				this.cnames = ""
				this.cnames2 = ""
				this.cnames_sp = ""
				this.completeName = ""
				this.files3id = []
				this.files3 = []
				this.fileList3 = []
				
				this.$forceUpdate()
			},
			
			// 科室树状图选择
			choseroom_user(data, node, treeNode) {
				this.treeClickCount4++;
				if (this.treeClickCount4 >= 2) {
					return;
				}
				this.timer = window.setTimeout(() => {
					if (this.treeClickCount4 == 1) {
						this.treeClickCount4 = 0;
						console.log('单击事件,可在此处理对应逻辑')
							
								this.did = treeNode.id
							this.page2=1
							this.getalluserlist()
						
					} else if (this.treeClickCount4 > 1) {
						this.treeClickCount4 = 0;
						
						this.ztree_obj_u.cancelSelectedNode();
						console.log('双击事件,可在此处理对应逻辑')
					}
				}, 300);
			},
			sure_user(){
				this.user_alert = false
				this.word_user = ''
				this.did = ''
				this.ztree_obj_u.cancelSelectedNode();
				this.getrooms()
				this.getalluserlist()
				
			},
			handleCurrentChange2(val) {
			  console.log(`当前页: ${val}`);
								this.page2 = val
								this.getalluserlist()
			},
			closeusertalert(){
				this.user_alert = false
				this.username = ''
				this.principalId = ''
				this.word_user = ''
				this.did = ''
				this.userid = ''
				this.uphone = ''
				this.ztree_obj_u.cancelSelectedNode();
				this.getrooms()
				this.getalluserlist()
			},
			// 获取弹窗里的用户
			getalluserlist() {
				this.choseall2 = false
				// console.log(this.page2)
				var id = this.did?this.did:''
				var that = this
				var url = encodeURI(this.$url + '/sys/user/list?page='+this.page2+'&limit='+this.limit2+'&deptId='+id+'&userName='+this.word_users)
				this.$http.get(url)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.user_all = response.data.data.records
						for (var i = 0; i < that.user_all.length; i++) {
							that.user_all[i].id = window.atob(that.user_all[i].id)
						}
						that.cuserlist = response.data.data.records
						for (var i = 0; i < that.cuserlist.length; i++) {
							that.cuserlist[i].id = window.atob(that.cuserlist[i].id)
						}
						
						if(that.utype == 'addsp'){
							var a = 0
							console.log(that.user_c)
							for (var i = 0; i < that.cuserlist.length; i++) {
								
								
								if(that.user_c.indexOf(that.cuserlist[i].id) > -1){
									a++
									that.cuserlist[i].chosesf = true
								}else{
									that.cuserlist[i].chosesf = false
								}
							}
							
						}else if(that.utype == 'addcs'){
							var a = 0
							console.log(that.user_c2)
							for (var i = 0; i < that.cuserlist.length; i++) {
								if(that.user_c2.indexOf(that.cuserlist[i].id) > -1){
									a++
									that.cuserlist[i].chosesf = true
								}else{
									that.cuserlist[i].chosesf = false
								}
							}
						}else{
							var a = 0
							for (var i = 0; i < that.cuserlist.length; i++) {
							
								if(that.user_c.indexOf(that.cuserlist[i].id) > -1){
									a++
									that.cuserlist[i].chosesf = true
								}else{
									that.cuserlist[i].chosesf = false
								}
							
							}
						}
						
						if(a == that.cuserlist.length){
							that.choseall2=true
						}else{
							that.choseall2=false
						}
						that.inglen2 = response.data.data.total
						if (that.inglen2 > that.limit2) {
							that.num2 = response.data.data.pages
						} else {
							that.num2 = 1
						}
						// console.log(that.cname)
					})
					.catch(function(error) {
						console.log(error);
						// sessionStorage.setItem('token','undefined')
						// that.$router.push('/login')
					});
			},
			// 获取科室
			getrooms() {
				var param = {
					parentId: 0
				}
				var that = this
				this.$http.post(this.$url + '/sys/dept/tree', this.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.zNodes_u = response.data.data
						that.ztree_obj_u = $.fn.zTree.init($("#treeDemo_p4"), that.setting_u, that.zNodes_u);
						that.ztree_obj_u = $.fn.zTree.init($("#treeDemo2"), that.setting_u, that.zNodes_u);
						 var  nodes = that.ztree_obj_u.getNodes();
						for  ( var  i = 0; i < nodes.length; i++) {  //设置节点展开
							that.ztree_obj_u.expandNode(nodes[i],  true ,  false ,  true );
						}
					})
					.catch(function(error) {
						console.log(error);
						
						that.$Toast('网络拥堵，刷新一下');
					});
			
			},
			openuseralert(){
				
				this.page2 = 1
				this.username = ''
				this.principalId = ''
				this.word_user = ''
				this.did = ''
				this.userid = ''
				this.uphone = ''
				
				// this.ztree_obj_u.cancelSelectedNode();
				this.getrooms()
				this.getalluserlist()
				this.user_alert = true
			},
			check_file(url){
					   window.open(url, '_blank');
			},
			uploadsuc3(file, fileList){
				if(file.code != 0){
					this.$Toast(file.msg)
					this.showloading=false
					return
				}
				 this.files3.push(file.data.relativePath)
				 this.files3id.push(file.data.id)
				 this.showloading=false
			
			},
			del_file3(i){
				var that = this
				var param = {fileId:this.files3id[i]}
				this.$http.post(this.$url + '/main/delete/file', this.$qs.stringify(param))
					.then(function(response) {
						console.log(response)
							that.files3.splice(i,1)
							that.files3id.splice(i,1)
						that.fileList3.splice(i,1)
						if(that.check == 1){
							that.addrw('check')
						}
					})
					.catch(function(error) {
						console.log(error);
						
						that.$Toast('网络拥堵，刷新一下');
					});
			},
			beforeUpload(e){
			
				this.showloading=true
				const fd = new FormData();
				 fd.append("file", e);
				 fd.append("project", 'rw');
				 fd.append("secret", this.$md5(e.name + 'gd' + e.size));
				
				var that = this
				this.$http.post(this.$url + '/file/upload', fd, {
						headers: {
							'Content-Type': 'multipart/form-data; boundary=something'
						}
					})
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						if(response.data.code != 0){
							that.$Toast(response.data.msg)
							that.showloading=false
							return
						}
						that.files3.push(response.data.data.relativePath)
						that.files3id.push(response.data.data.id)
						that.showloading=false
					})
					.catch(function(error) {
						console.log(error);
					});
					
				return false
				
			},
			beforeUpload2(e){
			
				this.showloading=true
				const fd = new FormData();
				 fd.append("file", e);
				 fd.append("project", 'xm');
				 fd.append("secret", this.$md5(e.name + 'gd' + e.size));
				
				var that = this
				this.$http.post(this.$url + '/file/upload', fd, {
						headers: {
							'Content-Type': 'multipart/form-data; boundary=something'
						}
					})
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						if(response.data.code != 0){
							that.$Toast(response.data.msg)
							that.showloading=false
							return
						}
						that.files3.push(response.data.data.relativePath)
						that.files3id.push(response.data.data.id)
						that.showloading=false
					})
					.catch(function(error) {
						console.log(error);
					});
					
				return false
				
			},
			handleSelect_xq(item) {
				this.uname_xq = item.realName
				this.xqinfo.adviceman = item.id	
			},
			querySearch_xq(queryString, cb) {
				var that = this
				var name = name = this.uname_xq?this.uname_xq:''
				
				var url = encodeURI(this.$url + '/sys/user/select?realName='+name)
				this.$http.get(url)
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.restaurants_xq = response.data.data
						that.restaurants_xq.unshift({userName:"账号",realName:"姓名",departName:"科室",phoneNo:"电话"})
						var restaurants_xq = that.restaurants_xq;
						var results = queryString ? restaurants_xq.filter(that.createFilter_xq(queryString)) : restaurants_xq;
						// 调用 callback 返回建议列表的数据
						if(results.length == 0){
							results.unshift({userName:"暂无内容",realName:"",departName:"",phoneNo:""})
						}else{
							if(results[0].id){
								results.unshift({userName:"账号",realName:"姓名",departName:"科室",phoneNo:"电话"})
							}
						}
						
						cb(results);
						// console.log(that.restaurants)
					})
					.catch(function(error) {
						console.log(error);						
						that.$Toast('网络拥堵，刷新一下');
					});
					
			  
			},
			createFilter_xq(queryString) {
				return (restaurant) => {
					// if(restaurant.realName){
						return (restaurant.realName.toLowerCase().indexOf(queryString.toLowerCase()) != -1);
					// }
				};
			},
			changedate(ty){
				if(this.info.beginDate && this.info.finishDate&& this.info.beginDate > this.info.finishDate){
					this.$Toast('选择的结束日期在开始日期之前');
					if(ty==1){
						this.info.beginDate = ''
					}else{
						this.info.finishDate = ''
					}
					return
				}
				
				
				if(this.byDate && this.byDate2 && this.byDate > this.byDate2){
					this.$Toast('选择的结束日期在开始日期之前');
					if(ty==1){
						this.byDate = ''
					}else{
						this.byDate2 = ''
					}
					return
				}
				
			},
			handleSizeChange(val) {
			       console.log(`每页 ${val} 条`);
								this.limit = val
								this.getlist()
			     },
			     handleCurrentChange(val) {
			       console.log(`当前页: ${val}`);
								this.page = val
								this.getlist()
			     },
				 // 全部项目名称
				getproject() {
				 	var that = this
				 	this.$http.get(this.$url + '/xm/selectAll')
				 		.then(function(response) {
				 			if (response.data.code == '1410') {
				 				that.$Toast(response.data.msg);
				 				sessionStorage.setItem('token', '')
				 				that.$router.push('/login')
				 				return
				 			}
				 			that.options3 = response.data.data
				 		})
				 		.catch(function(error) {
				 		});
				},
				//显示当前时间（年月日）
				timeFormate(timeStamp) {
					  let year = new Date(timeStamp).getFullYear();
					  let month =new Date(timeStamp).getMonth() + 1 < 10? "0" + (new Date(timeStamp).getMonth() + 1): new Date(timeStamp).getMonth() + 1;
					  let date =new Date(timeStamp).getDate() < 10? "0" + new Date(timeStamp).getDate(): new Date(timeStamp).getDate();
					 return year + "-" + month + "-" + date  ;
				},
			getlist() {
				this.showloading = true
				var param ={
						page: this.page,
						limit: this.limit,
						beginDate:this.byDates?this.timeFormate(this.byDates):'',
						endDate:this.byDate2s?this.timeFormate(this.byDate2s):"",
						xqName:this.naes,
						xmId: this.value2s,
					}
				var that = this
				this.$http.post(this.$url + '/xm/xq/allSelect', this.$qs.stringify(param))
					.then(function(response) {
						if (response.data.code == '1410') {
							that.$Toast(response.data.msg);
							sessionStorage.setItem('token', '')
							that.$router.push('/login')
							return
						}
						that.list = response.data.data
						that.inglen = response.data.count
						for (var i = 0; i < that.list.length; i++) {
							that.list[i].chosesf = false
						}
						that.choseall = false
						that.showloading = false
					})
					.catch(function(error) {
						console.log(error);
						// sessionStorage.setItem('token','undefined')
						// that.$router.push('/login')
						
						that.$Toast('网络拥堵，刷新一下');
					});
			},
		},

		computed: {},
	}
</script>
<style lang='less' scoped>
	/deep/ .el-input--prefix .el-input__inner {
		padding: 0 15px
	}

	.subli .radio .el-radio-group label {
		min-height: 34px;
		display: flex;
		align-items: center;
		margin-top: 0 !important;
		margin-bottom: 0 !important;
		margin-left: 0 !important;
		padding-left: 0;
	}

	.sublia {
		display: flex;

	}

	.subli textarea {
		width: 673px;
		height: 70px;
		background: #FFFFFF;
		border: 1px solid #CCCCCC;
		box-shadow: 0px 2px 0px 0px #EEEEEE;
		border-radius: 5px;
		outline: none;
		padding: 10px 10px;
	}

	.subli /deep/ .el-date-editor--date .el-input__inner,
	.subli /deep/ .el-date-editor.el-input,

	.subli /deep/ .el-input,
	.subli /deep/ .input,
	.el-date-editor.el-input__inner {
		width: 271px !important;
	}

	.subl {
		width: 100px;
		text-align: right;
		margin-right: 17px;
	}

	/* .el-date-editor--datetime {
		width: 100% !important;
	} */

	.el-date-editor--datetime .el-input__suffix {
		right: 25px;
		left: auto;
		width: 25px;
	}

	.el-date-editor--datetime .el-input__prefix {
		right: 5px;
		left: auto;
		width: 25px;
	}

	.subli /deep/ .el-input__prefix,
	.task_r /deep/ .el-input__prefix {
		right: 5px;
		left: auto;
		width: 25px;
	}

	.subli input,
	.subli .el-select {
		width: 271px;
		margin-left: 0;
	}

	.subli /deep/ .el-input__inner {
		height: 34px;
	}

	.subli label {
		margin-bottom: 0;
	}

	.sublist {
		padding-top: 15px;
	}

	.subli_left {
		display: flex;
		/* align-items: center; */
		width: 50%;
	}

	.subli {
		display: flex;
		/* align-items: center; */
		color: #000;
		margin-bottom: 15px;
		justify-content: space-between;
	}

	/deep/ .el-pagination__total {
		height: 33px !important;
		line-height: 33px !important;
	}

	/deep/ .el-input--mini .el-input__inner {
		height: 33px;
	}

	/deep/.el-pagination__editor.el-input .el-input__inner {
		height: 33px;
	}

	.page_box {
		display: flex;
		justify-content: flex-end;
		margin-top: 30px;
	}

	/deep/ .el-pagination .btn-prev {
		border: 1px solid #ccc;
		padding: 0;
		border-right: none;
		min-width: 33px;
		height: 33px;
		padding-top: 2px;
	}

	/deep/ .el-pagination .btn-next {
		border: 1px solid #ccc;
		padding: 0;
		border-left: none;
		min-width: 33px;
		height: 33px;
		padding-top: 2px;
	}

	/deep/ .el-pager li {
		border: 1px solid #ccc;
		padding: 0;
		border-right: none;
		min-width: 33px;
		height: 33px;
		line-height: 33px;
	}

	/deep/ .el-pager li:nth-last-of-type(1) {
		border-right: 1px solid #ccc;
	}

	/deep/ .el-pager li.active {
		border: #4286f5 1px solid;
		background: #4286f5;
		color: #fff;
	}

	.pages {
		display: flex;
		justify-content: flex-end;
		margin-top: 10px;
	}

	.buttons {
		display: flex;
		align-items: center;
		justify-content: center;
		padding-bottom: 38px;
	}

	.closebtn {
		width: 89px;
		height: 34px;
		background: #EEEEEE;
		border-radius: 6px;
		font-size: 14px;
		color: #434343;
		text-align: center;
		line-height: 34px;
		cursor: pointer;
	}

	.sure {
		width: 89px;
		height: 34px;
		line-height: 34px;
		background: #4286F5;
		border-radius: 6px;
		font-size: 14px;
		color: #FFFFFF;
		margin-right: 18px;
		text-align: center;
		cursor: pointer;
	}

	.w600 .modal-body.h100 {
		height: 170px;
		overflow: visible;
	}

	.line textarea {
		height: 75px;
	}

	.line input,
	.line select,
	.line textarea {
		width: 360px;
		color: #000;
	}

	.line_title span {
		color: #E65100;
	}

	.line_title {
		font-size: 14px;
		color: #000000;
		line-height: 34px;
		width: 80px;
		text-align: right;
	}

	.line {
		display: flex;
		margin-top: 19px;
		justify-content: center;

	}

	.modal-header.tit {
		font-size: 20px;
		color: #000;
		font-weight: normal;
	}

	.w600 {
		margin: calc(50vh - 165px) auto;
	}

	.tcent {
		text-align: center;
	}

	input[type='checkbox'] {
		opacity: 0;
		position: absolute;
		z-index: -2;
	}

	input[type="checkbox"]+label {
		width: 16px;
		height: 16px;
		border: 1px solid #c8c8c8;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 0;
		box-sizing: border-box;
		margin-right: 7px;
	}

	input[type="checkbox"]+label::before {
		content: '';
		display: block;
		margin-bottom: 0;
		box-sizing: border-box;
	}

	input[type="checkbox"]:checked+label {
		border: 1px solid #0075ff;
		box-sizing: border-box;
		background: #0075ff url(../../../assets/images/dui.png) no-repeat;
		background-size: 80% 80%;
		background-position-x: 20%;
		background-position-y: 20%;
	}

	input[type="checkbox"]:checked+label::before {
		background: #0075ff;
	}

	.search_inp {
		width: 255px;
		margin-bottom: 0;
	}

	.title {
		font-size: 24px;
		color: #000000;
	}



	.btns {
		width: 72px;
		padding: 0;
	}

	.zzc {
		width: 100vw;
		height: 100vh;
		position: fixed;
		z-index: 4;
		top: 0;
		left: 0;
	}

	.loading-content {
		position: absolute;
		z-index: 2000;
		/* background-color: rgba(0, 0, 0, 0.8); */
		margin: 0;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		transition: opacity 0.3s;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		/* width: 200px;
		height: 150px;
		border-radius: 10px; */
	}

	.loading-spinner {
		text-align: center;
	}

	.loading-spinner .circular {
		height: 42px;
		animation: loading-rotate 2s linear infinite;
	}

	.loading-spinner .path {
		animation: loading-dash 1.5s ease-in-out infinite;
		stroke-dasharray: 90, 150;
		stroke-dashoffset: 0;
		/* stroke- 2; */
		stroke: #000;
		stroke-linecap: round;
	}

	.loading-text {
		font-size: 14px;
		color: #000;
	}

	@keyframes loading-rotate {
		100% {
			transform: rotate(360deg);
		}
	}

	@keyframes loading-dash {
		0% {
			stroke-dasharray: 1, 200;
			stroke-dashoffset: 0;
		}

		50% {
			stroke-dasharray: 90, 150;
			stroke-dashoffset: -40px;
		}

		to {
			stroke-dasharray: 90, 150;
			stroke-dashoffset: -120px;
		}
	}

	.biaoq {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
	}

	.qx:hover {
		background: #edf3fd;
		color: #4286f5;
	}


	.down {
		background: #fff;
		position: absolute;
		top: 30px;
		right: 0;
		width: 130px;
		text-align: left;
		padding: 0 5px;
		z-index: 5;

		color: #666;
		box-shadow: 0 0 10px rgb(0 0 0 / 20%);

	}

	.li {
		border-bottom: 1px solid #f3f3f3;
		padding-left: 20px;
		height: 40px;
		line-height: 40px;
	}

	.li:nth-last-of-type(1) {
		border-bottom: none;
	}

	.more {
		position: relative;
	}

	.btns .iconfont {
		font-size: 10px;
		transition: all .3s;
		transform: rotateZ(0deg);
		line-height: 26px;
	}

	.actives {
		background: #4286f5;
		color: #fff;
	}

	td,
	th {
		font-size: 14px;
		color: #333;
		/* line-height: 22px; */
		padding: 10px;
		border-top: 0;
		border-bottom: 1px solid #eee;
	}

	.modal {
		position: absolute;
	}

	.modal-dialog {
		height: 97%;
	}

	.modal-header {
		position: sticky;
		top: 0;
		z-index: 50;
	}

	.modal-content {
		/* width: 85%; */
		margin: 0 auto;
		max-height: 100%;
		overflow: visible;
		/* height: 65vh; */
		/* overflow-y: scroll; */
	}

	.cent {
		width: 100%;
		align-items: center;
	}
</style>
